<?php
namespace app\home\controller;
use \think\Controller;
use app\home\model\KnowsModel;
class Knows extends Controller{
    /**
     * @return KnowsModel|array
     * 获取首页显示资讯
     */
    public function index(){
        $knows = new KnowsModel();
        $knows= $knows->getKnows();
        return $knows;
    }

    /**
     * @return KnowsModel|false|\PDOStatement|string|\think\Collection
     * 获取专题信息
     */
    public function getKspecial(){
        $msg =new KnowsModel();
        $msg = $msg->getKnowsSpecial();
        return $msg;
    }

    /**
     * 获取专题题目
     */
    public function getKnowName(){
        $res =new KnowsModel();
        $res=$res->getSpecialName();
        return $res;
    }

    /**
     * 获取专题详细信息
     */
    public function getKnowsInfo(){
        $id = input('id');
        $ip = $_SERVER["REMOTE_ADDR"];
        $knowsInfo = new KnowsModel();
        $knowsInfo =$knowsInfo->getKnowsInfomation($id);

        $count = new KnowsModel();
        $count->getCount($id,$ip);

        $this->assign('knowsInfo',$knowsInfo);
        return $this->fetch('babyhome/baby_msg');
    }

    /**
     * 获取浏览次数
     *
     */
    public function getCount($id){
        $count = new KnowsModel();
        $count = $count->getKonwsCount($id);
        return $count;
    }
}